package top.hidoctor.auscultation.adapter;

import android.graphics.drawable.Drawable;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import top.hidoctor.auscultation.R;
import top.hidoctor.auscultation.bean.ChooseInfo;

public class ChooseAdapter extends BaseQuickAdapter<ChooseInfo> {
    public ChooseAdapter(int layoutResId, List<ChooseInfo> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ChooseInfo item) {
        TextView tvName = helper.getView(R.id.tv_name);
        tvName.setText(item.getName());
        if (item.isCheck()) {
            Drawable drawableRight = mContext.getResources().getDrawable(R.mipmap.ic_gou);
            tvName.setCompoundDrawablesWithIntrinsicBounds(null, null, drawableRight, null);
            helper.setTextColor(R.id.tv_name, mContext.getResources().getColor(R.color.blue_main));
        } else {
            helper.setTextColor(R.id.tv_name, mContext.getResources().getColor(R.color.text_back));
            tvName.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
        }
    }
}
